#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    int arr[10][10] = { 0 };
    int a, b, flag = 0;
    scanf("%d %d", &a, &b);
    for (int c = 0; c < a * 2; c++)
    {
        for (int d = 0; d < b; d++)
        {
            scanf("%d", &arr[c][d]);
        }
    }
    for (int c = 0; c < a; c++)
    {
        for (int d = 0; d < b; d++)
        {
            if (arr[c][d] == arr[c + a][d])
                flag = 1;
            else { flag = 0; break; }
        }
    }
    if (flag == 1)
        printf("Yes");
    else printf("No");

}